<?php

namespace Agp\CoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

use APY\DataGridBundle\Grid\Mapping as GRID;

/**
 * Agp\CoreBundle\Entity\Telefone
 *
 * CLASSE
 * @ORM\Table(name="telefone")
 * @ORM\Entity(repositoryClass="Agp\CoreBundle\Repository\TelefoneRepository")
 * @ORM\HasLifecycleCallbacks
 * 
 * @GRID\Source(columns="codTelefone, descricao, operadora, dd, numero, notificacao")
 */
class Telefone
{
    /**
     * @var integer $codTelefone
     *
     * @ORM\Column(name="cod_telefone", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     *
     * @GRID\Column(title="Código", visible=false, type="text", size="5", primary=true)
     */
    protected $codTelefone;

    /**
     * @var object $empresa
     *
     * @ORM\ManyToOne(targetEntity="Empresa", fetch="LAZY", inversedBy="telefones")
     * @ORM\JoinColumn(name="cod_empresa", referencedColumnName="cod_empresa", onDelete="Cascade", nullable=false)
     */
    protected $empresa;

    /**
     * @var string $descricao
     *
     * @ORM\Column(name="descricao", type="string", length=42, nullable=false)
     * @Assert\NotBlank()
     * @Assert\Length(
     *      max = "21"
     * )
     * 
     * @GRID\Column(title="Descrição", type="text")
     */
    protected $descricao;

    /**
     * @var int $dd
     *
     * @ORM\Column(name="dd", type="integer", nullable=true)
     * 
     * @GRID\Column(title="DD", type="text", align="center")
     */
    protected $dd;
    
    /**
     * @var int $numero
     *
     * @ORM\Column(name="numero", type="integer", length=6, nullable=false)

     * @GRID\Column(title="Número", type="number", align="center")
     * @Assert\NotBlank()
     */
    protected $numero;
    
    const TP_FIXO = "Fixo";
    const TP_MOVEL = "Movel";
    /**
     * @var string $tipo
     *
     * @ORM\Column(name="tipo", type="string", length=42)
     * 
     * @GRID\Column(title="Tipo", type="text", align="center")
     */
    protected $tipo;
    
    /**
     * @var string $notificacao
     *
     * @ORM\Column(name="notificacao", type="boolean")
     * 
     * @GRID\Column(title="Notificação", type="boolean", align="center")
     */
    protected $notificacao;
    
    const OP_CLARO = "Claro";
    const OP_OI = "Oi";
    const OP_TIM = "Tim";
    const OP_VIVO = "Vivo";
    const OP_NEXTEL= "Nextel";
    /**
     * @var string $tipo
     *
     * @ORM\Column(name="operadora", type="string", length=42, nullable=true)
     * 
     * @GRID\Column(title="Operadora", type="text", align="center")
     */
    protected $operadora;
    
    public function __construct() {
        $this->notificacao = true;
    }

    public function getCodTelefone() {
        return $this->codTelefone;
    }

    public function getEmpresa() {
        return $this->empresa;
    }

    public function getDd() {
        return $this->dd;
    }

    public function getNumero() {
        return $this->numero;
    }

    public function getTipo() {
        return $this->tipo;
    }

    public function getNotificacao() {
        return $this->notificacao;
    }

    public function setCodTelefone($codTelefone) {
        $this->codTelefone = $codTelefone;
    }

    public function setEmpresa($empresa) {
        $this->empresa = $empresa;
    }

    public function setDd($dd) {
        $this->dd = $dd;
    }

    public function setNumero($numero) {
        $this->numero = $numero;
    }

    public function setTipo($tipo) {
        $this->tipo = $tipo;
    }

    public function setNotificacao($notificacao) {
        $this->notificacao = $notificacao;
    }
    
    public function getDescricao() {
        return $this->descricao;
    }

    public function setDescricao($descricao) {
        $this->descricao = $descricao;
    }
    
    public static function getTipoList(){
        return array(self::TP_FIXO => self::TP_FIXO,
                     self::TP_MOVEL => self::TP_MOVEL);
    }
    
    public function getOperadora() {
        return $this->operadora;
    }

    public function setOperadora($operadora) {
        $this->operadora = $operadora;
    }
    
    public static function getOperadoraList(){
        return array(self::OP_CLARO => self::OP_CLARO,
                     self::OP_OI => self::OP_OI,
                     self::OP_TIM => self::OP_TIM,
                     self::OP_VIVO => self::OP_VIVO,
                     self::OP_NEXTEL => self::OP_NEXTEL);
    }

}
